<template>
  <div id="menu">
    <h5  v-for="item in pages">
      <router-link :to="'/routerapi/page/' + item.id">{{ item.title }}</router-link>
    </h5>
    <h5>
      <router-link :to="{path:'/routerapi/article/',query:{name:'abc','keyword':'hello'}}">文章一</router-link>
    </h5>
    <h5>
      <button @click="$router.push({path:'/routerapi/article/',query:{name:'xyz','keyword':'world'}})">文章二</button>
    </h5>
  </div>
  <div id="content">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "RouterApi",
  data(){
    return{
      pages:[
        {id:1,title:'标题1'},
        {id:2,title:'标题2'},
        {id:3,title:'标题3'},
        {id:4,title:'标题4'},
        {id:5,title:'标题5'},
      ]
    }
  }
}
</script>

<style scoped lang="scss">
  #menu {
    width:30%;
    background:#F0FFF0;
    height:300px;
    float:left;
  }
  #content {
    width:70%;
    background: #cccccc;
    height:300px;
    float:right;
  }

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
</style>